<template>
  <el-dialog v-model="visible" fullscreen title="添加评估项" :close-on-click-modal="false">
    <div class="py-2">
      <el-button type="primary" @click="handleSave()">保存</el-button>
    </div>
    <div class="children:mb-4 mt-4">
      <evaluation-system-content ref="contentRef" />
      <evaluation-system-amount ref="amountRef" />
      <evaluation-system-suit-company ref="suitCompanyRef" />
    </div>
  </el-dialog>
</template>

<script setup lang="ts">
import {
  EvaluationSystemContent,
  EvaluationSystemAmount,
  EvaluationSystemSuitCompany
} from './components'

const visible = defineModel({ type: Boolean, required: true, default: false })

const contentRef = ref<any>()
const amountRef = ref<any>()
const suitCompanyRef = ref<any>()

const handleSave = () => {
  contentRef.value?.form.validate(() => {
    console.log(contentRef.value?.state)
  })

  amountRef.value?.form.validate(() => {
    console.log(amountRef.value?.state)
  })

  suitCompanyRef.value?.form.validate(() => {
    console.log(suitCompanyRef.value?.state)
  })
}

provide('visible', visible)
</script>
